//
//  SignViewController.m
//  简单豆瓣不得不交版 1 带
//
//  Created by dllo on 16/6/23.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SignViewController.h"
#import "ZhuCeViewController.h"

@interface SignViewController ()<UITextFieldDelegate>

@property(nonatomic, retain)UITextField *myField;
@property(nonatomic, retain)UIButton *myButton1;
@property(nonatomic, retain)UIButton *myButton2;



@end

@implementation SignViewController


- (void)dealloc{
    
    
    
    [_myField release];
    [super dealloc];
}



- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    // Do any additional setup after loading the view.
    
    self.navigationItem.leftBarButtonItem =  [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(leftAction:)];
    
    [self creatLabel];
    
    [self creatTextField];
    [self creatButton];
    self.myField.delegate = self;

}


- (void)creatLabel {
    UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 110, 70, 30)];
    [self.view addSubview:myLabel];
    myLabel.backgroundColor = [UIColor whiteColor];
    myLabel.text = @"用户名:";
    myLabel.font = [UIFont systemFontOfSize:21];
    [myLabel release];
    
    UILabel *myLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(40, 180, 70, 30)];
    [self.view addSubview:myLabel2];
    myLabel2.backgroundColor = [UIColor whiteColor];
    myLabel2.text = @"密码:";
    myLabel2.font = [UIFont systemFontOfSize:21];
    [myLabel2 release];
   
}


- (void)creatTextField{
    
    self.myField = [[UITextField alloc] initWithFrame:CGRectMake(160, 110, 180, 38)];
    [self.view addSubview:self.myField];
    /** 边框风格*/
    self.myField.borderStyle = UITextBorderStyleRoundedRect;
    self.myField.layer.borderWidth = 1;
    self.myField.layer.masksToBounds = YES;
    self.myField.layer.cornerRadius = 10;
    
    self.myField.placeholder = @"请输入用户名";
    [_myField release];
    
    UITextField *myField2 = [[UITextField alloc] initWithFrame:CGRectMake(160, 175, 180, 38)];
    [self.view addSubview:myField2];
    /** 边框风格*/
    myField2.borderStyle = UITextBorderStyleRoundedRect;
    myField2.layer.borderWidth = 1;
    myField2.layer.masksToBounds = YES;
    myField2.layer.cornerRadius = 10;
    
    myField2.placeholder = @"请输入密码";
    [myField2 release];
    // 改成数字键盘输入   键盘类型
    //    myField2.keyboardType = UIKeyboardTypePhonePad;

}


- (void)creatButton {
    
    self.myButton1 = [UIButton buttonWithType:UIButtonTypeCustom];
 //   self.myButton1.backgroundColor = [UIColor cyanColor];
    self.myButton1.frame = CGRectMake(42, 270, 140, 50);
    [self.view addSubview:self.myButton1];
   
    [self.myButton1 setImage:[UIImage imageNamed:@"DL.png"] forState:UIControlStateNormal];
    
    [self.myButton1 addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];

    self.myButton2 = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.myButton2.backgroundColor = [UIColor cyanColor];
    self.myButton2.frame = CGRectMake(240, 270, 140, 50);
    [self.view addSubview:self.myButton2];
    
    [self.myButton2 setImage:[UIImage imageNamed:@"ZC.png"] forState:UIControlStateNormal];
    
    [self.myButton2 addTarget:self action:@selector(buttonAction22:) forControlEvents:UIControlEventTouchUpInside];

    
    
}



- (void)buttonAction:(UIButton *)button{
    
    NSLog(@"我是登录");
    
    
    
}
- (void)buttonAction22:(UIButton *)button{
    
    ZhuCeViewController  *zhuCeVC = [[ZhuCeViewController alloc] init];
    
    [self.navigationController pushViewController:zhuCeVC animated:YES];
    
    
}






- (void)leftAction:(UIBarButtonItem *)item {
   
    [self.navigationController popViewControllerAnimated:YES];

    
}



// 键盘回收
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    
    [self.view endEditing:YES];
    return YES;
}






- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
